An LDPC is a packet error correcting code with a sparse check matrix, and is applicable to almost all channels. Performance of the LDPC code approaches the Shannon limit, and the LDPC code is characterized by being easy to describe and implement, easy for theoretical analysis and research, easy to decode with support for parallel operations, and suitable for hardware implementation. Therefore, in recent years, the LDPC code has become a hot research subject in the communications field.
LDPC codes have various bit lengths. For example, the Data Over Cable Service Interface Specification (DOCSIS) 3.1 protocol specifies three bit lengths, where a bit length of a long code is L=360, a bit length of a medium code is L=180, and a bit length of a short code is L=56. Generally, a decoder needs to support multiple bit lengths. For example, an LDPC decoder needs to support all the three LDPC bit lengths, including the long-code, medium-code, and short-code bit lengths. Currently, an LDPC decoder is designed in compliance with the maximum bit length. For example, an LDPC decoder of the bit length of 360 is used to decode LDPC codes of all bit lengths (56, 180, and 360). When an LDPC decoder of such design decodes LDPC codes of different bit lengths, different quantities of processing units are used for computation, and therefore, quantities of parallel operations supported are different, resulting in different processing performance. For example, for long codes, the processing performance is high but many resources are used, which causes difficulty in timing. For short codes, a quantity of parallel operations supported is relatively small such that the processing performance is too low to meet a traffic requirement.